<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>读书比赛列表</h2>
	</div>
	<div class="cf">
		<div class="fl">
            <eq name="isready" value="1"><a class="btn" href="{:U('add')}">新 增</a></eq>
        </div>

		<!-- 高级搜索 -->
        <form action="{:U('index')}" method="post" class="form-horizontal">
		<div class="search-form fr cf">		
			<div class="sleft">
				<input type="hidden" name="state" class="search-input" value="{:I('state')}"> 
				<input type="text" name="book_game_name" class="search-input" value="{:I('book_game_name')}" placeholder="请输入比赛名称"> 
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
				<!-- <button class="sch-btn" id="submit" type="submit" target-form="{:U('index')}" style="border:0;background:#fff;"><i class="btn-search"></i></button> -->
			</div>
		</div>
		</form>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
        <tr>
		<th class="">序号</th>
		<th class="">比赛名称</th>
		
			<eq name="isready" value="1"></eq>
			
			<eq name="isready" value="2">
			<th class="">开始时间</th></eq>
			 
			<eq name="isready" value="0">
			<th class="">开始时间</th>
			<th class="">结束时间</th></eq>
		
		
		<!-- <th class="">状态</th> -->
		<th class="">操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
			<td>{$key+1} </td>
			<td>{$vo.book_game_name}</td>
			
			<!-- <eq name="vo.isready" value="1">
			<td>未开始</td></eq>-->
			
			<eq name="vo.isready" value="2">
			<td><span>{$vo.start_time|time_format}</span></td>
			<!-- <td>进行中</td>-->
			</eq>
			 
			<eq name="vo.isready" value="0">
			<td><span>{$vo.start_time|time_format}</span></td>
			<td><span>{$vo.end_time|time_format}</span></td>
			<!-- <td>已结束</td> -->
			</eq>
			
			<td><eq name="vo.isready" value="1">
					<a href="{:U('Contest/changeStatus?method=start&id='.$vo['id'])}" class="confirm ajax-get">开始</a>
					<a href="{:U('Contest/edit?id='.$vo['id'])}" class="authorize">编辑详细</a>
					<a href="{:U('Contest/changeStatus?method=deleteContest&id='.$vo['id'])}" class="confirm ajax-get">删除</a>
				</eq>
				<eq name="vo.isready" value="2">
					<a href="{:U('Contest/changeStatus?method=shutdown&id='.$vo['id'])}" class="confirm ajax-get">结束</a>
					<a href="{:U('Contest/detail?id='.$vo['id'])}" class="authorize">比赛详细</a>
				</eq>
				<eq name="vo.isready" value="0">
					<a href="{:U('Contest/detail?id='.$vo['id'])}" class="authorize">比赛详细</a>
					<a href="{:U('Contest/changeStatus?method=deleteContest&id='.$vo['id'])}" class="confirm ajax-get">删除</a>
				</eq>
				
				<!-- <a href="{:U('Contest/detailClass?id='.$vo['id'])}" class="ajax-get" >涉及班级</a> -->
                </td>
		</tr>
		</volist>
		<else/>
		<td colspan="7" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

	<script type="text/javascript">
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
    //导航高亮
    highlight_subnav('{:U('Contest/index')}');
	</script>
</block>
